/*
* Vector2.h
*
*  Created on: Feb 17, 2011
*      Author: RRam
*/

#ifndef VECTOR2_H_
#define VECTOR2_H_

namespace GSP280Project3A
{
	class Vector2
	{
	private:
		//DATA MEMBERS...
		float x; //D001: X-coordinate
		float y; //D001: Y-coordinate

	public:
		Vector2(): x(0), y(0) {};									//C001: DEFAULT CONSTRUCTOR
		Vector2(float const &x, float const &y) : x(x), y(y) {};	//C002: OVERLOADED CONSTRUCTOR
		virtual ~Vector2() {};										//C003: DESTRUCTOR

		Vector2( const Vector2 &vect2 );							//C004: COPY CONSTRUCTOR
		Vector2 & operator=( const Vector2 &vect2 );				//C005: ASSIGNMENT OPERATOR

		void XY( const Vector2 &vect2 );							//M001: Set XY (location)
		void XY( const float &_x, const float &_y );				//M002: Set x AND y-value
		const Vector2 &XY() const;									//M003: Get XY (location)

		void X( const float &_x );									//M004: Set x-value
		const float &X() const;										//M005: Get x-value
		
		void Y( const float &_y );									//M006: Set y-value
		const float &Y() const;										//M007: Get y-value


		//OVERLOADED OPERATORS....
		const Vector2 operator +( const Vector2 &r );				//M008: Addition operator
		const Vector2 operator -( const Vector2 &r );				//M009: Subtraction operator
		const Vector2 operator *( const float &scalar );			//M010: Multiplication operator
		const Vector2 operator -() const;							//M011: Convert Location from +ve to -ve

		const Vector2 & operator +=( const Vector2 &r );			//M012: Increment Location by a given vector
		const Vector2 & operator -=( const Vector2 &r );			//M013: Decrement Location by a given vector

		//Magnitude: sqrt (x^2 + y^2)
		const float magnitude() const;								//M014: Calculate Magnitude

		Vector2 normalize();										//M015: Calculate Normal: (1/|A|) * A - 1 divided by magnitude A, multiplied by vector A<x,y>

		const float dotProduct(Vector2 const &vec1);				//M016: Calculate dotProduct


		//==================================
		//FUTURE METHODS.....
		//==================================
		/*
		void rotate( const float &angle );

		//Cross product between two vectors, returns a scalar
		const float crossProduct( const Vector2 &r ) const;
		*/

	};//end class

}//end namespace

#endif /* VECTOR2_H_ */
